10 REM WOODWARD-LAWSON ARRAY SYNTHESIS
20 REM "ANTENNA DESIGN USING PERSONAL COMPUTERS"
30 DIM A(30),F(180),FD(181),AD(10),BD(10),CD(10),DD(10),ED(10),BP(10)
40 DIM THN(30)
50 KEY OFF
60 PI=3.14159
70 ROD=PI/180
80 SCREEN 0,1
90 CLS
100 REM CLEAR FD ARRAY
110 FOR I=0 TO 181
120 FD(I)=0
130 NEXT I
140 COLOR 1,0
150 PRINT "WOODWARD-LAWSON ARRAY SYNTHESIS"
160 COLOR 4,0
170 PRINT
180 INPUT "HOW MANY ELEMENTS IN ARRAY";P
190 INPUT "WHAT IS THE ELEMENT SPACING(WAVELENGTHS)";D
200 PRINT "SPECIFY DESIRED PATTERN FROM THETA=0 TO 180 degrees"
210 INPUT "IN PIECEWISE FORM (P) OR IN SAMPLED FORM (S)";IS$
220 IF IS$="P" THEN GOTO 250
230 IF IS$="S" THEN GOTO 500
240 GOTO 200
250 PRINT
260 PRINT "ENTER SEGMENT ENDPOINTS IN DEGREES AND COEFFICIENTS OF DESIRED"
270 PRINT "PATTERN OF FORM: A + B*COS(THETA)**C + D*SIN(THETA)**E"
280 TH1=0
290 I=0
300 I=I+1
310 PRINT USING "FROM THETA=###. TO";TH1;
320 INPUT BP(I),AD(I),BD(I),CD(I),DD(I),ED(I)
330 IF BP(I)>180 THEN BP(I)=180
340 TH1=BP(I)
350 IF TH1<180 THEN GOTO 300
360 BP(I+1)=181
370 REM FILL FD WITH DESIRED PATTERN IN PIECEWISE FORM
380 IB=1
390 FOR I=0 TO 180
400 THR=I*ROD
410 IF I>BP(IB) THEN IB=IB+1
420 FD(I)=AD(IB)+BD(IB)*COS(THR)^CD(IB)+DD(IB)*SIN(THR)^ED(IB)
430 NEXT I
440 REM USE AVERAGE VALUES AT BREAKPOINTS OF FD
450 IB=1
460 FOR I=0 TO 180
470 IF I>BP(IB) THEN IB=IB+1
480 IF I=BP(IB) THEN FD(I)=.5*(FD(I)+FD(I+1))
490 NEXT I
500 IEVEN=0
510 IF P/2=INT(P/2) THEN IEVEN=1
520 N=P/2
530 IF IEVEN=0 THEN N=(P-1)/2
540 L=P*D
550 REM FILL THN ARRAY WITH THETA(AN)
560 FOR M=-N TO N
570 WN=M/L
580 TH=90
590 IF WN<>0 THEN TH=180/PI*ATN(SQR(1-WN*WN)/WN)
600 IF WN=-1 THEN TH=180
610 IF TH<0 THEN TH=TH+180
620 THN(N+M)=TH
630 NEXT M
640 IF IS$="P" THEN GOTO 720
650 REM FILL FD ARRAY FROM SAMPLES
660 PRINT
670 FOR M=N TO -N STEP -1
680 TH=THN(M+N)
690 PRINT USING "THETA=###.# degrees, FD(THETA)=";TH;
700 INPUT FD(TH)
710 NEXT M
720 REM NORMALIZE FD
730 FDM=0
740 FOR I=0 TO 180
750 IF FD(I)>FDM THEN FDM=FD(I)
760 NEXT I
770 IF FDM=0 THEN PRINT "ERROR-DESIRED PATTERN ALWAYS < 0"
780 FOR I=0 TO 180
790 FD(I)=FD(I)/FDM
800 NEXT I
810 REM FILL A ARRAY
820 FOR M=N TO -N STEP -1
830 TH=THN(M+N)
840 A(N+M)=FD(TH)
850 NEXT M
860 REM COMPUTE CURRENTS
870 PRINT
880 COLOR 14,0
890 PRINT "ELEMENT CURRENTS"
900 FOR M=-N TO N
910 IF IEVEN=1 AND M=0 THEN GOTO 1040
920 IR=0
930 II=0
940 ZM=M*D
950 IF IEVEN=1 AND M>0 THEN ZM=(2*M-1)*D/2
960 IF IEVEN=1 AND M<0 THEN ZM=(2*M+1)*D/2
970 FOR NN=-N TO N
980 IF A(NN+N)=0 THEN GOTO 1020
990 ARG=2*PI*ZM*NN/L
1000 IR=IR+A(NN+N)*COS(ARG)/P
1010 II=II-A(NN+N)*SIN(ARG)/P
1020 NEXT NN
1030 PRINT USING "###   ##.####  ##.####";M,IR,II
1040 NEXT M
1050 PRINT
1060 COLOR 4,0
1070 INPUT "DO YOU WISH TO PLOT PATTERNS(Y,N)";IP$
1080 IF IP$<>"N" THEN GOTO 1120
1090 INPUT "CONTINUE(Y,N)";IS$
1100 IF IS$="N" THEN GOTO 1610
1110 GOTO 80
1120 SCREEN 2,0
1130 VIEW (242,3)-(638,181)
1140 WINDOW (-3,-.4)-(185,1.5)
1150 LINE (0,0)-(180,0)
1160 FOR I=0 TO 180 STEP 30
1170 LINE (I,-.06)-(I,0)
1180 NEXT I
1190 LINE (90,0)-(90,1.5)
1200 FOR I=.25 TO 1.5 STEP .25
1210 LINE (85,I)-(95,I)
1220 NEXT I
1230 LOCATE 20,32
1240 PRINT "0      30      60      90     120     150     180"
1250 LOCATE 21,54
1260 PRINT "THETA"
1270 REM PLOT DATA
1280 IF IS$="S" THEN GOTO 1340
1290 REM PLOT DESIRED PATTERN IN PIECEWISE FORM
1300 PSET (0,FD(0))
1310 FOR I=1 TO 180
1320 LINE -(I,FD(I)),,,&HAAAA
1330 NEXT I
1340 REM PLOT SAMPLE POINTS
1350 FOR I=N TO -N STEP -1
1360 TH=THN(I+N)
1370 CIRCLE (TH,FD(TH)),3
1380 NEXT I
1390 FOR I=0 TO 180
1400 W=COS(I*ROD)
1410 F(I)=0
1420 FOR M=-N TO N
1430 IF A(M+N)=0 THEN GOTO 1520
1440 WN=M/L
1450 T=P
1460 CC=PI*D*(W-WN)
1470 T1=SIN(P*CC)
1480 T2=SIN(CC)
1490 IF ABS(W-WN)>.001 THEN T=T1/T2
1500 IF ABS(W-WN)>.001 AND ABS(T1)<.001 THEN T=0
1510 F(I)=F(I)+A(M+N)*T/P
1520 NEXT M
1530 IF I=0 THEN PSET (0,F(0))
1540 LINE -(I,F(I))
1550 NEXT I
1560 LOCATE 1,1
1570 PRINT "LINEAR SCALE"
1580 LOCATE 2,1
1590 INPUT "CONTINUE(Y,N)";IS$
1600 IF IS$<>"N" THEN GOTO 80
1610 SCREEN 0,1
1620 COLOR 7,0
1630 KEY ON
1640 END
